<template>
  <!-- vue2模板 -->
  <div>
    <!--  全局过滤器 (main.js声明) -->
    <h3>{{ title | addZero }}</h3>
    <input type="text" v-model="input">
    <!-- 局部过滤器 -->
    <h3>{{ input | Number }}</h3>

  </div>
</template>

<script>
export default {
  name: 'Test',
  components: {},
  data () {
    return {
      title: 9,
      input: 3.1415926
    };
  },
  props: {

  },
  mounted () {

  },
  filters: {
    Number (data) {
      console.log(data);
      let data2 = JSON.parse(data)
      return data2.toFixed(2)
    }
  },
  methods: {

  },
};
</script>

<style scoped>

</style>
